﻿using Catel.IoC;
using Catel.Logging;
using Catel.Services;
using System.Globalization;
using System.Windows;

namespace YtbDownloader;

/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App
{
    protected override void OnStartup(StartupEventArgs e)
    {
        LogManager.AddListener(new FileLogListener
        {
            FilePath = "{AppDataRoaming}\\Logs\\{Date}.log"
        });

        var languageSource = new LanguageResourceSource("YtbDownloader", "YtbDownloader.Locales", "Lang");
        ServiceLocator.Default.ResolveRequiredType<ILanguageService>().FallbackCulture = new CultureInfo("en-US");
        ServiceLocator.Default.ResolveRequiredType<ILanguageService>().RegisterLanguageSource(languageSource);
    }
}